#include <iostream>
#include <vector>

class StringHelper
{
public:
    static size_t splite(const std::string& str, const std::string& sep, 
            std::vector<std::string>& res)
    {
        int index = 0, pos = 0;
        while (index < str.size())
        {
            pos = str.find(sep, index);
            if (pos == std::string::npos)
            {
                res.push_back(str.substr(index));
                break;
            }

            if (index != pos)
            {
                res.push_back(str.substr(index, pos - index));
            }
            index = pos + sep.size();
        }
    }
};

int main()
{
    std::string str = "...news....music...#.pop...";
    std::vector<std::string> array;
    StringHelper::splite(str, ".", array);
    for (auto& str : array)
    {
        std::cout << str << std::endl;
    }

    return 0;
}